<html>
<head>
<meta charset="utf-8">
<title>事件搜索</title>
<link href="../westcss/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="../westcss/datatables.min.css" rel="stylesheet" type="text/css" />
<link href="../westcss/datatables.bootstrap.css" rel="stylesheet" type="text/css" />
<link href="../westcss/components.min.css" rel="stylesheet" id="style_components" type="text/css" />
<link href="../westcss/plugins.min.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="../westcss/layer.css">
<link rel="stylesheet" type="text/css" href="../westcss/jquery.datetimepicker.css"/>
<link rel="stylesheet" href="../westcss/font-awesome.min.css">
<!--	
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">	
-->
</head>
<body>
<div class="container-fluid">
	<div class="row-fluid">
		<div class="col-md-12">
			<div class="portlet light bordered">
					<div class="portlet-title">
						事件查找约束
					</div>
					<input type="text" id="datetimepicker1" placeholder="请输入起始时间" />
				
					<input type="text" id="datetimepicker2" placeholder="请输入终止时间"/>
				
					<input type="button" value="搜索" onclick="findEv();"/>
			</div>
				
		</div>
	</div>
	<div class="row-fluid">
		<div class="col-md-12">
			<div class="portlet light bordered">
							<div class="portlet-title">
								事件详情描述
							</div>
							<div class="portlet-body">
								<table class="table table-striped table-bordered table-hover" id="sample_1">
									<thead>
										<tr>
											<th> 事件记录表ID </th>
											<th> 事件发生时间 </th>
											<th> 事件类型 </th>
											<th> 威胁程度 </th>
											<th> 远程IP </th>
											<th> 本地IP </th>
											<th> 远程端口 </th>
											<th> 本地端口 </th>
											<th> 协议 </th>
											<th> dns </th>
											<th> 远程IP归属 </th>
											<th> 本地IP归属 </th>
											<th> 连接方向 </th>
											<th> 资产编号 </th>
											<th> 资产类型 </th>
											<th> 资产状态 </th>
											<th> 资产名称 </th>
											<th> 组织架构 </th>
											<th> 资产位置 </th>
										</tr>
									</thead>
									<tbody>
									   
									</tbody>
								</table>
							</div>
			</div>
		</div>
	</div>
</div>
<script src="../westjs/jquery.min.js" type="text/javascript"></script>
<script src="../westjs/bootstrap.min.js" type="text/javascript"></script>
<script src="../westjs/layer.js"></script>
<script src="../westjs/datatables.min.js" type="text/javascript"></script>
<script src="../westjs/datatables.bootstrap.js" type="text/javascript"></script>
<script src="../westjs/jquery.datetimepicker.full.js"></script>
<!--添加全局申请ip-->
    <script src="../gobal_ip/gobal_ip.js" type="text/javascript"></script>

<script type="text/javascript">
	$.ajaxSetup({
			async: false
	});
	//@ 时间
	$.datetimepicker.setLocale('ch');
	$('#datetimepicker1').datetimepicker({
		dayOfWeekStart : 1,
		lang:'ch',
		startDate:	'2017/01/01'
	});
	$('#datetimepicker2').datetimepicker({
		dayOfWeekStart : 1,
		lang:'ch',
		startDate:	'2017/01/01'
	});

	$(document).ready(function() {
		$('#sample_1').dataTable({
			"pageLength": 2,
			"lengthChange": false,
			"info":false,
			"searching":false,
			"data": "",			
		});   
	});

	function getTwoDensionArr(dension,len)
	{
		var arr=new Array();
		for(var i=0;i<dension;i++)
		{
			arr[i]=new Array();
			for(var j=0;j<len;j++)
			{
				arr[i][j]="dafault";
			}
		}
		return arr;
	}
	function findEv()
	{
		var start=$('#datetimepicker1').val().replace(/\//g, '-')+":00";
		var end=$('#datetimepicker2').val().replace(/\//g, '-')+":00";
		eventall=getTwoDensionArr(1,19);	
		tmp=[];
		var jsonEvObj={starttime:start,endtime:end};
		//var jsonEvObj={starttime:"2016-12-01 00:00:00",endtime:"2016-12-30 00:00:00"};
		$.get(encodeURI("http://"+global_ip+"/networkassetinfocon/geteventintimewindow?param="+JSON.stringify(jsonEvObj)),function(data){
			eventall.length=data.data.length;
				$(data.data).each(function(index,items){
					tmp.push(items.id);
					tmp.push(items.sj);
					tmp.push(items.sjlx);
					tmp.push(items.wxcd);
					tmp.push(items.ycip);
					tmp.push(items.bdip);
					tmp.push(items.ycdk);
					tmp.push(items.bddk);
					tmp.push(items.xy);
					tmp.push(items.dns);
					tmp.push(items.ycwz);
					tmp.push(items.bdwz);
					tmp.push(items.ljfx);
					tmp.push(items.zcbh);
					tmp.push(items.zclx);
					tmp.push(items.zczt);
					tmp.push(items.zcmc);
					tmp.push(items.zzjg);
					tmp.push(items.zcwz);
					
					eventall[index]=tmp;
					tmp=[];
				})
		});
/*
		$.ajax({
			url: "../subwest/data/eventAll.json",
			async: false,//改为同步方式
			type: "GET",
		//	data: { arg: val },
			success: function (data) {
				eventall.length=data.data.length;
				$(data.data).each(function(index,items){
					tmp.push(items.id);
					tmp.push(items.sj);
					tmp.push(items.sjid);
					tmp.push(items.jlms);
					tmp.push(items.ycip);
					tmp.push(items.bdip);
					tmp.push(items.ycdk);
					tmp.push(items.bddk);
					tmp.push(items.xy);
					tmp.push(items.dns);
					tmp.push(items.ycwz);
					tmp.push(items.bdwz);
					tmp.push(items.ljfx);
					tmp.push(items.zzjg);
					tmp.push(items.zcwz);
					
					eventall[index]=tmp;
					tmp=[];
				})
			}
		});
*/
			
		$('#sample_1').dataTable({
			"destroy": true,
			"data": eventall,	
			"searching":false,
			"pageLength": 2,
			"lengthChange": false,
			"info":false,
			 buttons: [
				{ extend: 'print', className: 'btn dark btn-outline' },
				{ extend: 'pdf', className: 'btn green btn-outline' },
				{ extend: 'csv', className: 'btn purple btn-outline ' }
			],
			//responsive: true,
			colReorder: {
				reorderCallback: function () {
					console.log( 'callback' );
				}
			},
			"order": [
				[0, 'asc']
			],
			"dom": "<'row' <'col-md-12'B>><'row'<'col-md-6 col-sm-12'l><'col-md-6 col-sm-12'f>r><'table-scrollable't><'row'<'col-md-5 col-sm-12'i><'col-md-7 col-sm-12'p>>"
		});
	}
		
</script>
</body>
<html>